home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / pascal / pstui100.zip / PTUI.PAS < prev    next >
Pascal/Delphi Source File  |  1993-02-16  |  13KB  |  379 lines

  1. {
  2.  
  3.                                                       ╔══════════════════╗
  4.                                                       ║    Text User     ║
  5.                                                       ║    Interface     ║
  6.                                                       ║    Rev.  1.00    ║
  7.                                                       ╚══════════════════╝
  8.  
  9. }
  10.  
  11. Unit PTUI;
  12.  
  13. {$F+} {$O-} {$A+} {$G+}
  14. {$V-} {$B-} {$X-} {$N+} {$E+}
  15.  
  16. {$I FINAL.PAS}
  17.  
  18. {$IFDEF FINAL}
  19.   {$I-} {$R-}
  20.   {$D-} {$L-} {$S-}
  21. {$ENDIF}
  22.  
  23. Interface
  24.  
  25. Uses CRT,Strings,PTUIMDef,PTUIMSE,PTUIVMSE,PTUIVCRT,KeyDef;
  26.  
  27. Const
  28.   MouseLeftButton  =    0;
  29.   MouseRightButton =    1;
  30.   MouseMiddleButton=    2;
  31.   MouseGranularity =    8;
  32.   SpecialNIL       =    Ptr($FFFF,$FFFF);
  33.  
  34. Type
  35.   LineStyles       = (DoubleLine,SingleLine,NoLine);
  36.   ShadowStyles     = (LightHash,MediumHash,DarkHash,Solid,NoShade);
  37.  
  38.   HideOrShow       = (Hidden,Visible);
  39.  
  40.   SlideBarInfo     = Record
  41.                        X1,Y1,X2,Y2        :Word;
  42.                        Forg               :Word;
  43.                        Back               :Word;
  44.                        MainChar           :Char;
  45.                        ButtonChar         :Char;
  46.                        UpLeftChar         :Char;
  47.                        DownRightChar      :Char;
  48.                        CurPos             :LongInt;
  49.                        MaxPos             :LongInt;
  50.                        ButtonScreenPos    :Word;
  51.                        ButtonNum          :Word;
  52.                        BarButtonNum       :Word;
  53.                        ButtonLeftUpNum    :Word;
  54.                        ButtonRightDownNum :Word;
  55.                      End;
  56.  
  57.   ButtonListPtr    = ^ButtonList;                {Buttons to click on}
  58.  
  59.   ButtonList = Record
  60.                  X1,Y1,X2,Y2:Word;               {Screen Co-ordinate}
  61.                  Special    :Boolean;            {Keyboard Keys}
  62.                  Key        :Char;               {Keyboard Character}
  63.                  Number     :Word;               {It's own Unique Number}
  64.                  Next       :ButtonListPtr;      {Next Button in Linked List}
  65.                End;
  66.  
  67.   ButtonChain     = Object
  68.                       Total          :Word;
  69.  
  70.                       Procedure Init;
  71.                       Function  Position     :Word;
  72.                       Function  Number       :Word;
  73.                       Procedure GotoPosition (Here:Word);
  74.                       Procedure GotoNumber   (ButtonNumber:Word);
  75.  
  76.                       Procedure Add          (X1, Y1, X2, Y2:Word;
  77.                                               Special:Boolean; Key:Char);
  78.  
  79.  
  80.                       Procedure Move         (X, Y:Integer;
  81.                                               ButtonNumber:Word);
  82.  
  83.                       Procedure MoveAll      (X, Y:Integer);
  84.  
  85.                       Procedure WaitForClick (Var X, Y:Word;Var MouseButtons:Byte;
  86.                                               Var Held,Doubled,Special:Boolean;
  87.                                               Var Key:Char);
  88.  
  89.                       Procedure KillAll;
  90.                       Procedure KillFrom;
  91.                       Procedure KillOne;
  92.  
  93.                       Private
  94.  
  95.                       Root           :Pointer;
  96.                       Buttons        :ButtonListPtr;
  97.  
  98.                       Function NewButtonNumber:Word;
  99.  
  100.                     End;
  101.  
  102.   MouseFunctions  = Object
  103.                       Init       :MouseProc_Init;
  104.                       Show       :MouseProc_Show;
  105.                       Hide       :MouseProc_Hide;
  106.                       SetSpeed   :MouseProc_SetSpeed;
  107.                       SetXY      :MouseProc_SetXY;
  108.                       SetBounds  :MouseProc_SetBounds;
  109.                       GetPresses :MouseProc_GetPresses;
  110.                       GetXY      :MouseProc_GetXY;
  111.                       GetStatus  :MouseProc_GetStatus;
  112.                       GetClick   :MouseProc_GetClick;
  113.  
  114.                       Function  ComputerSpeed:LongInt;
  115.                       Function  Active       :Boolean;
  116.  
  117.                     End;
  118.  
  119.   TextWindow      = Object
  120.                       VSlide         :SlideBarInfo;
  121.                       HSlide         :SlideBarInfo;
  122.  
  123.                       HdrButtonNum   :Word;           {Button Numbers}
  124.  
  125.                       Buttons        :ButtonChain;    {The window's buttons}
  126.  
  127.                       Card           :MonoOrColor;
  128.                       Status         :HideOrShow;     {Visible or Not}
  129.                       LineStyle      :LineStyles;     {Box Outline Style}
  130.                       ShadowStyle    :ShadowStyles;   {Shadow Style}
  131.                       ShadowXSize,
  132.                       ShadowYSize,
  133.                       BoxFrg,                       {Forg Colour}
  134.                       BoxBck,                       {Back Colour}
  135.                       ShdFrg,                       {Shadow Colour}
  136.                       ShdBck,
  137.                       HdrFrg,                       {Header Forg}
  138.                       HdrBck    :Byte;              {Header Back}
  139.                       Size,                         {Memory Required}
  140.                       X1,Y1,                        {Location on Screen}
  141.                       X2,Y2     :Word;
  142.                       Header    :String;            {Heading Line}
  143.                       HdrFmt    :TextFormats;       {Header Position}
  144.  
  145.                       Procedure Open(NX1,NY1,NX2,NY2:Word;Forg,Back,
  146.                                      ShadForg,ShadBack:Byte;
  147.                                      LStyle:LineStyles;SStyle:ShadowStyles);
  148.                       Procedure DisplayHeading;
  149.                       Procedure NewHeading(NewHead:String;NewMode:TextFormats;
  150.                                            Forg,Back:Byte);
  151.                       Procedure Hide;
  152.                       Procedure Show;
  153.                       Procedure NewPosition(NewX,NewY:Word);
  154.                       Procedure Drag;
  155.                       Procedure DragVertSlideButton;
  156.                       Procedure DragHorzSlideButton;
  157.                       Procedure NewSize(NX1,NY1,NX2,NY2:Word);
  158.                       Procedure NewStyle(Forg,Back,ShadForg,ShadBack:Byte;
  159.                                          LStyle:LineStyles;SStyle:ShadowStyles);
  160.  
  161.                       Procedure HeadingIcon           (Active:Boolean);
  162.  
  163.                       Procedure VertSlideIcon         (Active:Boolean);
  164.                       Procedure DrawVertSlideBar;
  165.                       Procedure VertSlideBar          (Details:SlideBarInfo);
  166.                       Procedure UpdateVertSlideBar    (CurPos:LongInt);
  167.  
  168.                       Procedure HorzSlideIcon         (Active:Boolean);
  169.                       Procedure DrawHorzSlideBar;
  170.                       Procedure HorzSlideBar          (Details:SlideBarInfo);
  171.                       Procedure UpdateHorzSlideBar    (CurPos:LongInt);
  172.  
  173.                       Procedure HeadingPos             (Var BX1,BY1,BX2,BY2:Word);
  174.                       Procedure VertSlideBarPos        (Var BX1,BY1,BX2,BY2:Word);
  175.                       Procedure VertSlideButtonPos     (Var BX1,BY1,BX2,BY2:Word);
  176.                       Procedure VertSlideButtonUpPos   (Var BX1,BY1,BX2,BY2:Word);
  177.                       Procedure VertSlideButtonDownPos (Var BX1,BY1,BX2,BY2:Word);
  178.                       Procedure HorzSlideBarPos        (Var BX1,BY1,BX2,BY2:Word);
  179.                       Procedure HorzSlideButtonPos     (Var BX1,BY1,BX2,BY2:Word);
  180.                       Procedure HorzSlideButtonLeftPos (Var BX1,BY1,BX2,BY2:Word);
  181.                       Procedure HorzSlideButtonRightPos(Var BX1,BY1,BX2,BY2:Word);
  182.  
  183.                       Procedure Lock;
  184.                       Procedure UnLock;
  185.                       Procedure Close;
  186.  
  187.                       Private
  188.  
  189.                       Save      :Pointer;           {Memory Area for background}
  190.  
  191.                       Procedure SaveBackground;
  192.                       Procedure DrawWindow;
  193.                     End;
  194.  
  195. Procedure EnableVScreen(V